// 扩展settings，增加merge/parse方法
import "./SettingReader";
import Vue from 'vue';
import settings from "@/settings";
import { ColumnConfig } from '../schema';

import { Importer } from "./Importer";
import { router } from "./VueRouter";
import { store } from "./VuexStore";
import { HTMLRenderer, ResourceRenderer } from "./Renderer";

export class Bootstrap {
  constructor() {
    Vue.prototype.$settings = settings;
    // 生产环境关掉提示
    Vue.config.productionTip = false;
  }
  start() {
    // 装载导入器
    Vue.use(new Importer());
    // 装载渲染器
    Vue.use(new HTMLRenderer());
    Vue.use(new ResourceRenderer());
    let vm = new Vue({
      el: '#app',
      router,
      store,
      render: h => h("router-view"),
      mounted() {
        store.dispatch('init', this);
        ColumnConfig.Vue = this;
      }
    });
    Vue.use({ vm });
  }
}
